package com.xinxin.facelinker;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by xinxin on 2015/7/20.
 */
public class Config {

    public static final String SERVER_URL = "http://172.18.231.1";
    public static final String CATEGORIES_URL = "http://172.18.231.1/face/NewFile.jsp";// 获取分类信息的接口
    public static final String UPDATESOFTADDRESS = SERVER_URL + "/trywebservise/chatdemo-ui.apk";// 版本更新的地址

    public static final String ACTION = "action";
    public static final String CONNECT_VERSION_UPDATE_FAIL = "fail to connenct versionupdating";

    public static String CONTENT = "content";
    public static final String ACTION_CHANGE_FLUSER_INFO = "change_fluser_info";

    public static final String ACTION_LOGON = "logon";
    public static final String ACTION_LOGIN = "login";
    public static final String ACTION_FORGET_PASSWORD = "forget_password";
    public static final String ACTION_ADD_INFO = "add_info";
    public static final String ACTION_SHOW_PALS = "show_pals";
    public static final String ACTION_GET_PAL_INFO = "get_pal_info";
    public static final String ACTION_ADD_BLACKLIST = "add_blacklist";
    public static final String ACTION_SHOW_BLACKLIST = "show_blacklist";
    public static final String ACTION_SEARCH_USER = "search_user";
    public static final String ACTION_SHOW_PALS_MOTION = "show_pals_motion";
    public static final String ACTION_SHOW_MOTION = "show_motion";
    public static final String ACTION_SHOW_MY_MOTION = "show_my_motion";
    public static final String ACTION_ADD_MY_MOTION = "add_my_motion";
    public static final String ACTION_RECEIVE_NEW_PALS = "receive_new_pals";
    public static final String ACTION_ACCEPT_ADD_NEW_PAL = "accept_add_new_pal";
    public static final String ACTION_REFUSE_ADD_NEW_PAL = "refuse_add_new_pal";
    public static final String ACTION_SEND_NEW_PAL_MESSAGE = "send_new_pal_message";
    public static final String ACTION_GET_LOGON_VERIFICATION_CODE = "get_logon_verification_code";
    public static final String ACTION_SHOW_MALE_TOPLIST = "show_male_toplist";
    public static final String ACTION_SHOW_FEMALE_TOPLIST = "show_female_toplist";
    public static final String ACTION_PHOTO_CHANGE = "photo_change";

    public static final String APP_ID = "com.xinxin.facelinker";
    public static final String KEY_TOKEN = "token";
    public static final String KEY_PHONE_NUM = "phone_num";
    public static final String KEY_PASSWORD = "password";
    public static final String KEY_LOGIN_NUM = "login_num";
    public static final String KEY_MY_ACCOUNT_NUM = "my_account_num";
    public static final String KEY_OTHER_ACCOUNT_NUM = "other_account_num";
    public static final String KEY_GENDER = "gender";
    public static final String KEY_EMAIL = "email";
    public static final String KEY_BIRTHDAY = "birthday";
    public static final String KEY_NICKNAME = "nickname";
    public static final String KEY_PHOTO_URL = "photo_url";
    public static final String KEY_PICTURE_URL = "picture_url";
    public static final String KEY_SEARCH_USER_ACCOUNT_NUM = "search_user_account_num";
    public static final String KEY_MOTION = "motion";
    public static final String KEY_MOTION_ID = "motion_id";
    public static final String KEY_MY_MOTION = "my_motion";
    public static final String KEY_RECEIVE_NEW_PAL_MESSAGE = "receive_new_pal_message";
    public static final String KEY_SEND_NEW_PAL_MESSAGE = "send_new_pal_message";
    public static final String KEY_JOB = "job";
    public static final String KEY_MOTION_PHOTO_URL = "motion_photo_url";
    public static final String KEY_DATE = "date";
    public static final String KEY_API_KEY="api_key";
    public static final String KEY_API_SECRET="api_secret";
    public static final String KEY_FACE_ID="face_id";
    public static final String KEY_ATTRIBUTE="attribute";
    public static final String KEY_URL="url";
    public static final String KEY_PERSON_ID="person_id";
    public static final String KEY_PERSON_NAME="person_name";
    public static final String KEY_FACESET_ID="faceset_id";
    public static final String KEY_FACESET_NAME="faceset_name";
    public static final String KEY_GROUP_ID="group_id";
    public static final String KEY_GROUP_NAME="group_name";

    public static void cacheToken(Context context, String token) {
        SharedPreferences.Editor e = context.getSharedPreferences(APP_ID, Context.MODE_PRIVATE).edit();
        e.putString(KEY_TOKEN, token);
        e.commit();
    }

    public static String getCachedAccountNum(Context context) {
        return context.getSharedPreferences(APP_ID, Context.MODE_APPEND).getString(KEY_MY_ACCOUNT_NUM, null);
    }

    public static void cacheAccountNum(Context context, String account_num) {
        SharedPreferences.Editor e = context.getSharedPreferences(APP_ID, Context.MODE_PRIVATE).edit();
        e.putString(KEY_MY_ACCOUNT_NUM, account_num);
        e.commit();
    }

    public static final String ACTION_CHANGE_FLUSER_PASSWORD = "change_fluser_password";

}
